Use the code below to create a navigationView with a collapsible button at the top left of the screen. I don't want the navigationView to be collapsed and keep the DoubleColumn state. Is there a way to disable this button.
struct NavigationViewPadTest: View {
var body: some View {
NavigationView{
List(0..<30){ i in
Text("id:\(i)")
}
Text("abc")
}
.navigationViewStyle(DoubleColumnNavigationViewStyle())
}
}
thanks
Post
Replies
Boosts
Views
Activity
I will use persistentStoreDescriptions in many occasions to configure my Coredata. for example one description is used to synchronize cloudkit and another is set to be stored locally.
For persistentStoreDescriptions I do it in the Model Editor provided by Xcode. But I always had a question.
<configuration name="local" usedWithCloudKit="YES">
<memberEntity name="Student"/>
</configuration>
<configuration name="memory">
<memberEntity name="Teacher"/>
</configuration>
In the .xcdatamodeld file, in the configuration it is possible to see which Entities are included and which use use Cloudkit, but I can't see from the container, store, coordinator, persistentStoreDescriptions and NSManagedObjectModel objects to get any relationship between the configuration and the entity.
I'm just curious if it's possible to see this in the code, or if it's just another piece of Apple's black magic.
I am trying to use the new API provided by WWDC21 to create Core Data databases that can be shared.
When I do the sharing for an NSManageObject, I tried to experiment with 2 methods.
1: Using UICloudSharingController's
UICloudSharingController(preparationHandler: (UICloudSharingController, @escaping (CKShare?, CKContainer?, Error?) -> Void) -> Void)
method.
Currently this method works and the participants can get all the data after accepting the invitation.
2:Use NSPersistentContainer's
share(_ managedObjects: [NSManagedObject], to share: CKShare?) async throws -> (Set<NSManagedObjectID>, CKShare, CKContainer)
method.
First get ckshare, then call
UICloudSharingController(share:, container: )
With this approach, after accepting the invitation, the participant only gets the data generated after the creation of the ckshare, and the data before the ckshare is never fetched
I'm not sure if it's an error in the token generated by the share method of the NSPersistentContainer or something else. Has anyone encountered a similar situation?
I have added the contents of my app to iOS Spotlight via the CSSearchableItemAttributeSet and it is very easy to find them from spotlight in use.
I'd like to achieve a similar effect in the app via CSSearchQuery, but I'm currently running into a problem.
In the system's spotlight, users can use fuzzy queries to find the information they want.
I can't enter Chinese characters in the forum, 'hello' should be Chinese characters
for example, if my content is in Chinese, 'hello', users can find the content not only by 'hello' but also by using 'nihao' to find the same content.('nihao' is the Latin pinyin equivalent of the Chinese word 'hello').
However, I am unable to achieve a similar effect in CKSearchQuery. At the moment CKSearchQuery only has [cdwt] four ways, is there any other means to achieve the above query capability.
Or perhaps Apple does not have this capability open in CKSearchQuery.
I tried to build LocalizedKeyString using String's new Initializer.
String(localized: "hello",locale: locale)
When I change the language setting of the device, everything works as expected.
However, when I try to get the string in a specific language using the specified Locale, I can only ever get the string in .current.
String(localized: "hello",locale: Locale(identifier: "zh-cn"))
func getString(locale:Locale) -> String{
String(localized: "hello",locale: locale)
}
If you change the display language of the project (or the language setting of the device), the text in Text is always displayed correctly.
Text(getString(locale:.current))
However, the code in onAppear
print(getString(locale:Locale(identifier: "zh-cn")))
It only displays the same content as Text, but not the specified Chinese.
Is it my fault that the new Initializer The understanding is not correct, or the bug of String
init(localized keyAndValue: String.LocalizationValue, table: String? = nil, bundle: Bundle? = nil, locale: Locale = .current, comment: StaticString? = nil)
FB number: FB9675845
In Core Data, I can merge two predicates (perform an OR operation) using the following code:
let compound3 = NSCompoundPredicate(type: .or, subpredicates: [compound1, compound2])
How can I achieve a similar operation in SwiftData with new Predicate?